﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zeta;
using Zeta.Internals.Actors;
using Zeta.Internals.SNO;

namespace UltimatePlugin.Db.Cache
{
    internal class CachedUnit : CachedObject
    {
        public CachedUnit(DiaObject dia)
            :base(dia, CachedType.Unit)
        {
        }

        internal override CachedObject Clone()
        {
            return (CachedUnit)this.MemberwiseClone();
        }

        public double HitpointsCurrent 
        { 
            get; 
            set; 
        }

        public bool IsDead
        {
            get
            {
                return HitpointsCurrent <= 0;
            }
        }

        public bool IsElite 
        { 
            get; 
            set; 
        }

        public bool IsRare 
        { 
            get; 
            set; 
        }

        public bool IsUnique 
        { 
            get; 
            set; 
        }

        public bool IsRareEliteUnique
        {
            get
            {
                return IsUnique || IsRare || IsElite;
            }
        }

        public MonsterSize MonsterSize 
        { 
            get; 
            set; 
        }

        public MonsterType MonsterType 
        { 
            get; 
            set; 
        }

        public bool IsBurrowed 
        { 
            get; 
            set; 
        }

        public bool IsUntargetable 
        { 
            get; 
            set; 
        }

        public bool IsInvulnerable 
        { 
            get; 
            set; 
        }

        public bool IsNpc 
        { 
            get; 
            set; 
        }

        public bool IsMinion 
        { 
            get; 
            set; 
        }

        public bool IsBoss { get; set; }

        public override string ToString()
        {
            return string.Format("CachedUnit : ACDGuid={0} - IsAttackable={1} - MonsterSize={2} - MonsterType={3} - IsNpc={4} - CentreDistance={5} - HitpointsCurrent={6} - CurrentAnimation={7}",
                AcdGuid,
                IsAttackable,
                MonsterSize,
                MonsterType,
                IsNpc,
                CentreDistance,
                HitpointsCurrent,
                CurrentAnimation);
        }
    }
}
